<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>用户行为助手</title>
    {include file="common/linkcss" /}
</head>

<body>

    <div class="weui-navbar" style="position: fixed;">
        <a class="weui-navbar__item weui-bar__item--on" href=" javascript:;">
            用户
        </a>
        <a class="weui-navbar__item  " href="{:url('log/type',array('cid'=>$cid))}">
            行为
        </a>
    </div>

    <div class="page__pd" style="padding-top:50px">
        <div class="weui-panel weui-panel_access">
            <div class="weui-panel__bd" id="list"></div>
        </div>
        <div class="weui-loadmore">
            <i class="weui-loading"></i>
            <span class="weui-loadmore__tips">正在加载</span>
        </div>
    </div>

    <script id="listScript" type="text/html">
        <% for (var i = 0; i < data.length; i ++) { %>
            <a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg">
                <div class="weui-media-box__hd">
                    <img class="weui-media-box__thumb" src="<%= data[i].uid.image %>">
                </div>
                <div class="weui-media-box__bd">
                    <h4 class="weui-media-box__title">
                        <%= data[i].uid.name %>
                        <span class="weui-media-box__title-after"><%= data[i].create_time.day %>日<%= data[i].create_time.time %></span>
                    </h4>
                    <p class="weui-media-box__desc"><%= data[i].des %></p>
                </div>
            </a>
        <% } %>
    </script>

    <script>
        var page = 1;

        $.get("{:url('log/lst')}", {
            page: page,
            cid: "{$cid}"
        }, function (res) {
            var html = template('listScript', res);
            $('#list').html(html);
            page++;
            $('.weui-loadmore').hide();
        })
        var loading = false; //状态标记
        $(document.body).infinite().on("infinite", function () {
            if (loading) return;
            loading = true;
            $('.weui-loadmore').show();
            $.get("{:url('log/lst')}", {
                page: page,
                cid: "{$cid}"
            }, function (res) {
                var html = template('listScript', res);
                $('#list').append(html);
                loading = false;
                page++;
                $('.weui-loadmore').hide();
            })
        });
    </script>


</body>


</html>